* STATA Do file for Chapter 6, Mark R. Beissinger, The Revolutionary City  
version 14
clear all
set more off
log using Logfiles\chapter6.log, replace
* ============================================================================
* STATISTICAL RESULTS APPEARING IN CHAPTER 6
* STATA Do file for Chapter 6  
* Results reported in Chapter 6  
* Author: Mark R. Beissinger  
* Date:  January 2022  
* Princeton, NJ 
* =============================================================================
* BEFORE RUNNING, YOU MUST SET THE DEFAULT PATH FOR WHERE THE DATA
*   FILES RESIDE
* =============================================================================
* Before running, you must download the following packages for STATA:
*   firthlogit from http://fmwww.bc.edu/RePEc/bocode/f
* =============================================================================
* The following datafiles are used for this chapter:
*   Data on revolutionary episodes--revolutionaryeps.dta
*   Data set of urban civic revolt locations--urbancivicspaces.dta
*   Data set on population of capital cities, 1900-2014--capitalpopulations.dta
* =============================================================================
* Output produced:  Logfiles\chapter6.log
*					Logfiles\figure6_1.pdf
*   --All output from this chapter has been combined into a single file and can 
*		be found in a pdf file (chapter6.pdf) in the "Outputfiles" folder
* =============================================================================

* =========================================================
* DEMONSTRATIONS VS. OTHER TACTICAL FORMS IN URBAN REVOLTS
* =========================================================
clear
use revolutionaryeps.dta
logit success strikes demonstrations riots armed startyear if urbandum==1, or
margins, atmeans at(strikes=0 demonstration=1 riots=0 armed=0)
margins, atmeans at(strikes=1 demonstration=0 riots=0 armed=0)
margins, atmeans at(strikes=1 demonstration=0 riots=1 armed=1)
* Controlling for participation
logit success strikes demonstrations riots  armed startyear lnparticnum if urbandum==1, or
* In rural revolutions
logit success demonstrations riots landseizures c.startyear##c.startyear if urbandum==0, or

* =======================================================================
* ROLE OF LAND SEIZURES IN RURAL REVOLUTIONS IN MAGNIFYING PARTICIPATION
* =======================================================================
glm particnum landseizures lndeaths startyear if startyear>1899 & urbandum==0, family(gamma) link(log) vce(robust)
margins, atmeans at(landseizures=(0 1))

* ===============================================
* ROLE OF SYMBOLIC SPACES IN URBAN CIVIC REVOLTS
* ===============================================
clear
use urbancivicspaces.dta
ttest particnum, by( natrelsymbols)

* =======================================================================
* RELATIONSHIP BETWEEN USE OF SQUARES AND SUCCESS IN URBAN CIVIC REVOLTS
* =======================================================================
tab rallysquare success, col chi

* ==================================================
* DISTANCE OF URBAN CIVIC REVOLTS FROM SEAT OF GOVT
* ==================================================
sum distance, detail

* ==========================================================================
* FIGURE 6.1: DISTANCE OF URBAN CIVIC REVOLTS FROM SEAT OF GOVT, BY OUTCOME
* ==========================================================================
graph box newdistance, over(success)
graph export Logfiles\figure6_1.pdf, replace

* =====================================================
* T-TEST OF EFFECT OF DISTANCE SEAT OF GOVT ON OUTCOME
* =====================================================
ttest newdistance , by(success)

* ==========================================================================
* PROBABILITY OF OPPOSITION VICTORY IF WITHIN 3/4 KILOMETER OF SEAT OF GOVT
* ==========================================================================
logit success veryclose lnpartic, or nolog
margins, atmeans at(veryclose=(0 1))
* Further controls
firthlogit success veryclose lnpartic c.newpolitymin1##c.newpolitymin1 lnoill newmilexpsold10tile newgdppcthl newincumbpowerdur

* ====================================================
* RELATIONSHIP OF PROTEST OUTSIDE CAPITAL AND SUCCESS
* ====================================================
tab keyinother success, col chi

* =========================================================================
* DATA FOR FIGURE 6.2:  CONCENTRATION OF POPULATIONS AROUND CAPITAL CITIES
* =========================================================================
clear
use capitalpopulations.dta
table year , c( mean capperc semean capperc) replace
rename table1 mean
rename table2 semean
generate ul= mean + (1.96 * semean)
generate ll= mean - (1.96 * semean)
list year mean ul ll, clean noobs
* Data were then loaded into MS Excel to produce figure

log close

clear
